<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script src="js/jquery-1.11.0.min.js"></script>
</head>
<body>
<div>
    <input type="hidden" name="id" id="id">
    电话：<input type="text" id="phone" name="phone"> <br>
    密码：<input type="text" id="password" name="password"> <br>
    身份证号：<input type="text" id="id_num" name="id_num"> <br>
    用户名：<input type="text" id="username" name="username"> <br>
    </form>
    <input type="button" value="保存" id="updateBtn">
</div>
<table width="100%" id="shouye">
    <tr>
        <td align="center"><a href="/airong/index.html">首页</a></td>
        <!--    <td align="center"><a href="#"><input type="button" id="lc" value="理财"></a></td>-->
        <td align="center"><a href="" id="lc">理财</a></td>
        <td align="center"><a href="/airong/personalCenter.html">我的</a></td>

    </tr>
</table>
</body>
<script>
  let url = "/airong/user?action=findOne"
  let params = {}
  $.get(url,params,function (user){
    $("#phone").val(user.phone);
    $("#password").val(user.password);
    $("#id_num").val(user.id_num);
    $("#username").val(user.username);
  },"json");


  $("#updateBtn").click(function (){
      let phone = $("#phone").val();
      let password =$("#password").val();
      let id_num = $("#id_num").val();
      let username = $("#username").val();
      let params = {phone,password,id_num,username}
    let url = "/airong/user?action=update";

    $.post(url,params,function (data){
      if (data === "\"true\""){
          alert("保存成功")
        location.href = "personalCenter.html"
      }else {
        alert("保存失败")
          location.href = "personalCenter.html"
      }
    },"text")
  })
  let urll = "/airong/cc?action=getSessionID";
  let paramsl = {}
  $.get(urll,paramsl,function (sessionID){
      document.getElementById('lc').href= "products.html?uid="+sessionID;
  },"text")

</script>
<style>
    div {

        width: 100%;
        text-align: center;
    }
    input{
        padding: 10px;
        margin: 10px;
        text-align: left;
    }
    #shouye{
        position: absolute;
        top: 600px;
        padding: 5px;
        margin: 4px;
        background-color: bisque;
        font-size: 20px;
        text-align: center;
        z-index: 1;
    }
</style>
</html>